{extend name="base" /}
{block name="content"}
<script src="__STATIC__/public/My97DatePicker/WdatePicker.js"></script>
<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="{:url('index/welcome')}"><i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>cms</span>
            <span class="icon-angle-right"></span>
            <span>管理信息</span>
            <span class="icon-angle-right"></span>
            <span>{$column_name}</span>
            <span class="icon-angle-right"></span>
            <span>信息列表</span>
            <a class="u-flush"><i class="icon-repeat"></i></a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">
            <table class="m-table">
                <tr>
                    <th>
                        <div class="m-options cf">
<!--                            <div class="m-opts fl"><a href="{:url('add', ['column_id' => $column_id])}" class="u-btn"><i class="icon-plus"></i>添加信息</a></div>-->
<!--                            <div class="m-search fr">-->
<!--                                <form action="" class="layui-form">-->
<!--                                    <label for="">信息属性</label>-->
<!--                                    <div class="lay-select m-select-tiny">-->
<!--                                        <select name="ismember">-->
<!--                                            <option value="-1"{if condition="$ismember eq -1"} selected{/if}>全部信息</option>-->
<!--                                            <option value="0"{if condition="$ismember eq 0"} selected{/if}>管理员发布</option>-->
<!--                                            <option value="1"{if condition="$ismember eq 1"} selected{/if}>前台投稿</option>-->
<!--                                        </select>-->
<!--                                    </div>-->
<!--                                    <div class="lay-select m-select-tiny">-->
<!--                                        <select name="checked">-->
<!--                                            <option value="-1"{if condition="$checked eq -1"} selected{/if}>全部信息</option>-->
<!--                                            <option value="0"{if condition="$checked eq 0"} selected{/if}>审核不通过</option>-->
<!--                                            <option value="1"{if condition="$checked eq 1"} selected{/if}>审核通过</option>-->
<!--                                        </select>-->
<!--                                    </div>-->
<!--                                    <div class="lay-select m-select-tiny">-->
<!--                                        <select name="isgood">-->
<!--                                            <option value="-1">全部</option>-->
<!--                                            {foreach name="attr['isgood']" key="k" item="v"}-->
<!--                                            <option value="{$k}"{if condition="$isgood eq $k"} selected{/if}>{$v}</option>-->
<!--                                            {/foreach}-->
<!--                                        </select>-->
<!--                                    </div>-->
<!--                                    <div class="lay-select m-select-tiny" style="width: auto">-->
<!--                                        <div style="float: left"><select name="province" lay-filter="province"></select></div>-->
<!--                                        <div style="float: left"><select name="city" lay-filter="city"></select></div>-->
<!--                                        <div style="float: left"><select name="district"></select></div>-->
<!--                                    </div>-->
<!--                                    <label for="">发布时间</label>-->
<!--                                    <input type="text" name="start_time" class="u-ipt u-ipt-small" placeholder="开始时间" value="{$startTime ?: ''}" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly />-->
<!--                                    <span>-</span>-->
<!--                                    <input type="text" name="end_time" class="u-ipt u-ipt-small" placeholder="结束时间" value="{$endTime ?: ''}" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly />-->
<!--                                    <label for="keywords">关键词</label>-->
<!--                                    <input type="text" name="keywords" id="keywords" class="u-ipt u-ipt-def" placeholder="请输入要查询的关键词" value="{$keywords}" />-->
<!--                                    <input type="hidden" name="column_id" value="{$column_id}" />-->
<!--                                    <input type="submit" class="u-btn u-search" value="查看" />-->
<!--                                </form>-->
<!--                            </div>-->
                        </div>
                    </th>
                </tr>
            </table>
            <form class="layui-form m-list-form">
                <table class="m-table mt-10">
                    <tbody class="datas">
                        <tr>

<!--                            <th width="5%">排序</th>-->
<!--                            <th width="5%">ID</th>-->

                            <th width="30%">标题</th>

                            <th width="10%">操作</th>
                        </tr>
                        {foreach name="data" item="v"}
                        <tr>

<!--                            <td><input type="text" name="list_order[{$v.id}]" lay-skin="primary" class="u-ipt u-ipt-tiny" value="{$v.list_order}" /></td>-->
<!--                            <td>{$v.id}</td>-->

                            <td>{$v.title}</td>

                            <td class="m-opt"><a href="{:url('add', ['column_id' => $v['column_id'], 'id' => $v['id']])}" title="编辑"><i class="icon-pencil"></i></a>
<!--                                <a href="javascript:;" title="删除" class="u-del" data-id="{$v.id}"><i class="icon-trash"></i></a>-->
                            </td>
                        </tr>
                        {/foreach}

                    </tbody>
                </table>
            </form>
            {include file="public:page" /}
        </div>
    </div>
</div>
<input type="hidden" name="redirect_uri" value="{:url('contents/index', ['column_id' => $column_id])}" />
{/block}
{block name="extrajs"}
{include file="laypage" /}
<script>
    layui.use(['layer', 'form'], function(){
        var layer  = layui.layer,
                form   = layui.form;
        var province_id ="";
        var city ="";
        var district ="";
        //城市三级联动
        var p_options="";
        var c_options="";
        var a_options="";
        $.getJSON("/static/data/address.json", "", function(data) {
            //each循环 使用$.each方法遍历返回的数据date
            p_options+="<option value='-1'>全部省份</option>";
            c_options+="<option value='-1'>全部城市</option>";
            a_options+="<option value='-1'>全部区域</option>";
            $.each(data, function(i, item) {
                // console.log(item)
                p_options+="<option value='"+item.region_id+"'>"+item.region_name+"</option>";
                if(item.region_id==province_id){
                    $.each(item.child, function(i, citem) {
                        c_options+="<option value='"+citem.region_id+"'>"+citem.region_name+"</option>";
                        if(citem.region_id==city){
                            $.each(citem.child, function(i, aitem) {
                                a_options+="<option value='"+aitem.region_id+"'>"+aitem.region_name+"</option>";
                            });
                        }
                    });
                }
            });

            //省
            $("select[name='province']").html(p_options);
            $("select[name='province'] option").attr("selected",false);
            $("select option[value='"+province_id+"']").attr("selected",true);

            $("select[name='city']").html(c_options);
            $("select[name='city'] option").attr("selected",false);
            $("select option[value='"+city+"']").attr("selected",true);

            $("select[name='district']").html(a_options);
            $("select[name='district'] option").attr("selected",false);
            $("select option[value='"+district+"']").attr("selected",true);

            form.render('select');
        });
    });
</script>
{/block}